﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using QldtSdh.Utils;

namespace QldtSdh.BLL
{
    class BizConfig
    {
        public static Dictionary<string, string> GetConfig()
        {
            try
            {
                var name = ConfigUtil.GetConfig("nguoiquanly");
                if (name != null)
                {
                    Dictionary<string, string> dic = new Dictionary<string, string>();
                    foreach (XElement xEle in name)
                    {
                        dic.Add(xEle.Attribute("id").Value, xEle.Value.Trim());
                    }
                    return dic;
                }
                else
                    return null;
            }
            catch
            {
                throw new Exception("Không thể tải file Config.XML");
            }
        }

        public static CODE_RESULT_RETURN Update(string key, string value)
        {
            return ConfigUtil.Update("nguoiquanly", key, value);
        }
    }
}
